import Vue from './Vue';

const vm = new Vue({
    el: "#app",
    data() {
        return {
            isShowImg1: false,
            isShowImg2: true
        }
    },
    template: `
    <div>
        <div>
            <img v-if="isShowImg1" width="200" src="http://localhost:3000/src/assets/1.jpg" />
            <img v-show="isShowImg2" width="200" src="http://localhost:3000/src/assets/2.jpg" />
        </div>
        <button @click="changeImg1">图片1显示</button>
        <button @click="changeImg2">图片2显示</button>
    </div>
    `,
    methods: {
        changeImg1: function () {
            this.isShowImg1 = !this.isShowImg1;
        },
        changeImg2: function () {
            this.isShowImg2 = !this.isShowImg2;
        }
    }
})